/*
 * bsp_adc.h
 *
 *  Created on: 2019��1��14��
 *      Author: fly
 */

#ifndef BSP_INC_BSP_ADC_H_
#define BSP_INC_BSP_ADC_H_

#include <stdint.h>

#define ADC_CHANNEL_NUM 2
#define ADC_MAX_VALUE 1023
typedef struct _BSP_ADC_CHANNEL_ST {
  uint32_t result_sum;
  uint16_t max;
  uint32_t average;  // average
  uint16_t min;
  uint32_t cnt;
  uint8_t finish;
} BSP_ADC_CHANNEL_ST;
typedef struct _BSP_ADC_ST {
  // uint32_t reault_sum;
  // uint16_t result;

  uint8_t adc_ch;
  BSP_ADC_CHANNEL_ST channel[ADC_CHANNEL_NUM];
  uint16_t adc_tmp_buf[ADC_CHANNEL_NUM];

  uint8_t busy;
  uint8_t finish;
} BSP_ADC_ST;

void bsp_ADC_init(void);
BSP_ADC_ST *bsp_ADC_ST_get(void);
void bsp_ADC_start(void);

#endif /* BSP_INC_BSP_ADC_H_ */
